import axios from "axios"

//创建一个axios实例(创建一个副本)
const request = axios.create({
  baseURL: "/api1",
  timeout: 10000,
  headers: {},
})
//配置请求拦截器1
request.interceptors.request.use(
  (config) => {
    return config
  },
  (error) => {
    return Promise.reject(error)
  }
)
//配置响应拦截器
request.interceptors.response.use(
  (response) => {
    return response.data
  },
  (error) => {
    return Promise.reject(error)
  }
)

export default request
